package waysing.cream.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import waysing.cream.controller.base.BaseController;
import waysing.cream.entity.Movie;
import waysing.cream.service.MovieSourceService;

/**
 * Created by weixin on 2018/3/8.
 */
@RestController
public class MovieReourceController extends BaseController {
    @Autowired
    private MovieSourceService movieSourceService;
    @RequestMapping("/capture/movie")
    public Object searchMovie(@RequestParam("name") String name){
        Movie movie = movieSourceService.captureFromDouban(name);
        return setResult(movie);
    }
    @RequestMapping("/search/movie")
    public Object search(@RequestParam("name") String name){
        return setResult(movieSourceService.searchByName(name));
    }

    @RequestMapping("/movie/get")
    public Object getRandDomMovie(@RequestParam("count") int count){
        return setResult(movieSourceService.getMovie(count));
    }

    @RequestMapping("/test2")
    public Object test2(){
        return setResult("哈哈哈哈哈");
    }
    @RequestMapping("/test0")
    public String test(){
        String[] strs = {"1","2"};
        System.out.print(strs[4]);
        return "ss";
    }


}
